<template>
    <div>
        <div class="header" style="background-color: white">
            <el-page-header @back="goBack" content="详情">
            </el-page-header>
        </div>
        <div v-if="target=='case_law'">
            <CaseLawDetails :rows="rows"></CaseLawDetails>
        </div>
        <div v-if="target=='apply'">
            <apply-details  :rows="rows"></apply-details>
        </div>
        <div v-if="target=='case_seal_applyfor'">
            <CaseSealApplyforDetails  :rows="rows"></CaseSealApplyforDetails>
        </div>
        <div v-if="target=='case_decrease'">
            <moneymoney  :id="rows.id"></moneymoney>
        </div>

        <div style="width: 100%;">
            <el-header style="font-size: 20px;position: relative;left: -20px;top: 20px">
                <i class="el-icon-user"></i>/审批记录
            </el-header>
            <el-table
                    :data="FlowAudits"
                    border
                    style="width: 100%;">
                <el-table-column
                        fixed
                        prop="aid"
                        label="序号">
                </el-table-column>
                <el-table-column
                        fixed
                        prop="createdate"
                        label="审批时间">
                </el-table-column>
                <el-table-column
                        fixed
                        prop="userRealname"
                        label="办理人">
                </el-table-column>
                <el-table-column
                        fixed
                        prop="info"
                        label="审批状态">
                    <template slot-scope="scope">
                        {{scope.row.info == 'Y' ? '同意':'不同意'}}
                    </template>
                </el-table-column>
                <el-table-column
                        prop="remark"
                        label="备注">
                </el-table-column>
            </el-table>
        </div>

        <el-divider></el-divider>
        <div style="width: 100%;position: relative">
            <el-header style="font-size: 20px;position: relative;left: -20px;top: 20px">
                <i class="el-icon-s-check"></i>/审批结果
            </el-header>
            <!--审批中-->
            <div style="position: relative;margin-left: 85%">
                <img :src="imgUrl" />
            </div>
        </div>
    </div>
</template>

<script>

    import CaseLawDetails from './CaseLawDetails.vue'
    import CaseSealApplyforDetails from './CaseSealApplyforDetails.vue'
    import ApplyDetails from './ApplyDetails.vue'
    import Moneymoney from './Moneymoney.vue'

    import  FlowAuditService from '../../../model/mfy/flow/FlowAuditService.js'
    const flowAuditService=FlowAuditService.getInstance();


    export default {
        name: "SelectFlow",
        props:['row'],
        data(){
            return{
                rows:this.row,
                target:this.row.target,
                FlowAudits:[],
                flowInfo:{
                    refuse:'https://qy-file-bucket.oss-cn-beijing.aliyuncs.com/flow/9a903af5-6b35-4569-92e2-b82830057bec.png?Expires=1926498478&OSSAccessKeyId=LTAI4GCXS6Qi9BqpB7S55n3u&Signature=1Skj5rBCJc49t%2B6rPJbxj5iPqws%3D',
                    allow:'https://qy-file-bucket.oss-cn-beijing.aliyuncs.com/flow/80c9d0d8-9620-4d1b-b8a3-c3991cb3573b.png?Expires=1926498432&OSSAccessKeyId=LTAI4GCXS6Qi9BqpB7S55n3u&Signature=ovd8Pw4ZHh8aiQ2tsmmFE8LLPGE%3D',
                    auditing:'https://qy-file-bucket.oss-cn-beijing.aliyuncs.com/flow/ca4f4eeb-92f6-4347-b2b7-515b894e2d06.png?Expires=1926498505&OSSAccessKeyId=LTAI4GCXS6Qi9BqpB7S55n3u&Signature=O%2BRL8VMehC6d%2BsE99rLBKGG%2BdQ0%3D'
                },
                imgUrl:''
            }
        },
        created(){
            this.selectByFid();
            this.setImgUrl()
        },
        methods:{
            selectByFid(){
                flowAuditService.selectByFid(this.rows.fid).then(response=>{
                    this.FlowAudits = response.data.data
                })
            },
            setImgUrl(){
                switch (this.target) {
                    case 'apply' : this.getResult(this.row.status);break;
                    case 'case_seal_applyfor' : this.getResult(this.row.applyforApprovalStatus);break;
                    case 'case_law' : this.getResult(this.row.caseApproveStatus);break;
                    case 'case_decrease' : this.getResult(this.row.status);break;
                }
            },
            getResult(value){
                if(value == '1') {
                    this.imgUrl = this.flowInfo.auditing
                }else if(value == '2'){
                    this.imgUrl = this.flowInfo.refuse
                }else{
                    this.imgUrl = this.flowInfo.allow
                }
            },
            goBack(){
                this.$emit('back')
            }
        },
        watch:{
            row:function () {
                this.rows=this.row;
                this.target=this.row.target
                this.setImgUrl()
            },
            deep:true
        },
        components:{
            CaseSealApplyforDetails,
            CaseLawDetails,
            ApplyDetails,
            Moneymoney
        }
    }
</script>

<style scoped>

</style>
